﻿/// <reference path="AjaxSuccess.js" />
/// <reference path="three-column.helper.js" />



function OpenLayout(action) {





    OpenLayoutTab(ajaxParam);

    AjaxCall(action, ajaxParam.target);
    SetToOrDefaultTab(ajaxParam.tabIndexToActivate);
}


function OpenLayoutTab(successParam) 
{

   var layoutTabIndex = GetTabIndex(layoutOverview_Text);
   if (layoutTabIndex == -1) {


       var count = $(tab_id).tabs('length');
       if (count < 3) {
           $(tab_id).tabs("add", tab_2_id, layoutOverview_Text);
           successParam.target = tab_2_id;
           successParam.tabIndexToActivate = 2;
       } else {
           $(tab_id).tabs("add", tab_3_id, layoutOverview_Text);
           successParam.target = tab_3_id;
           successParam.tabIndexToActivate = 3;
       }
   }
   else {

       successParam.tabIndexToActivate = layoutTabIndex;
       if (layoutTabIndex == 2) {
           successParam.target = tab_2_id;

       }
       else {
           successParam.target = tab_3_id; 
       }
   }

}
